package com.totcy.atom.presenter.contract;

import com.totcy.atom.bean.AppVersion;
import com.totcy.baselibrary.base.mvpbase.BaseModel;
import com.totcy.baselibrary.base.mvpbase.BaseView;

import java.io.File;

/**
 * description :  CheckUpdate contact
 *
 * @author : Totcy
 * @date : 2018/11/1 11:17
 */
public interface CheckUpdateContract {

    interface View extends BaseView {
        /**
         * @param appVersion
         */
        void onUpdateInfo(AppVersion appVersion);

        void onDownloadFinish(File apkFileName);

        void onDownloadProgress(int progress);

    }

    interface Presenter {
        /**
         * Presenter 调用 model 获取数据
         */
        void doCheckUpdate();

        void downloadApk(String downloadUrl);

    }

    interface Model extends BaseModel {
        interface DataCallback {
            /**
             * 数据获取成功  返回实体
             *
             * @param appVersion
             */
            void onUpdateInfo(AppVersion appVersion);

            void onDownloadFinish(File apkFileName);

            void onDownloadProgress(int progress);
        }

        /**
         * 网络获取数据
         */
        void doCheckUpdate(DataCallback callback);

        void downloadApk(String downloadUrl, DataCallback callback);
    }
}
